package Actions;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import javax.swing.AbstractAction;
import javax.swing.JOptionPane;
import javax.swing.JTable;

import Model.SubProgramChair;
import View.AssignPaperView;
public class AssignPaperAction extends AbstractAction {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private SubProgramChair spc;
	private AssignPaperView asgnPaper;
	private JTable table;
	
	public AssignPaperAction(JTable a_table, SubProgramChair a_spc) {
		table = a_table;
		spc = a_spc;
		this.putValue(NAME, "Assign Paper");
		this.putValue(MNEMONIC_KEY, KeyEvent.VK_R);
		
	
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		if(table.getSelectedRow() != -1){
			asgnPaper = new AssignPaperView(table, spc);
			asgnPaper.start();
			asgnPaper.updateLabels();
			table.repaint();
		} else{
			JOptionPane.showMessageDialog(null, "Please choose a manuscript to be assigned");
		}
			
	
		
	}

}


